package com.codeworker.dbenumdatademo.entity;

import java.io.Serializable;

/**
 * (StuInfo)实体类
 *
 * @author code-worker
 * @since 2021-10-10 10:27:27
 */
public class StuInfo implements Serializable {
    private static final long serialVersionUID = 497264200570489753L;
    
    private Integer stuId;
    
    private String stuName;
    
    private Gender stuGender;

    private enum Gender {
        //性别
        男, 女, 未知
    }

    public Integer getStuId() {
        return stuId;
    }

    public void setStuId(Integer stuId) {
        this.stuId = stuId;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public Integer getStuGender() {
        return stuGender.ordinal()+1;
    }

    public void setStuGender(Integer stuGenderIndex) {
        this.stuGender = Gender.values()[stuGenderIndex-1];
    }

    @Override
    public String toString() {
        return "StuInfo{" +
                "stuId=" + stuId +
                ", stuName='" + stuName + '\'' +
                ", stuGender=" + stuGender +
                '}';
    }

    public static void main(String[] args) {
        StuInfo stuInfo = new StuInfo();
        stuInfo.setStuGender(1);
        stuInfo.setStuId(1);
        stuInfo.setStuName("张三");
        System.out.println(stuInfo);

        StuInfoPO stuInfoPo = new StuInfoPO();
        stuInfoPo.setStuGender(1);
        stuInfoPo.setStuId(1);
        stuInfoPo.setStuName("张三");
        StuInfoVO stuInfoVO = EntityTransform.INSTANCE.poToVo(stuInfoPo);
        System.out.println(stuInfoVO);
        System.out.println(EntityTransform.INSTANCE.voToPo(stuInfoVO));
    }

}

